﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace AAA.Forms.Components.Util
{
    public class ListBoxUtil
    {
        public static void MoveItem(ListBox lstSource, ListBox lstTarget, SelectionTypeEnym eSelectionType)
        {

            switch (eSelectionType)
            {
                case SelectionTypeEnym.Selected :
                    foreach (object oSelectedItem in lstSource.SelectedItems)
                    {
                        lstTarget.Items.Add(oSelectedItem);
                        lstSource.Items.Remove(oSelectedItem);
                    }
                    break;

                case SelectionTypeEnym.All:
                    foreach (object oSelectedItem in lstSource.Items)
                    {
                        lstTarget.Items.Add(oSelectedItem);
                        lstSource.Items.Remove(oSelectedItem);
                    }
                    break;
            }
        }
    }
}